<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>hello world</title>
    <style>
        .p{
            color:aqua;
        }
    </style>
</head>
<!-- ng-app指定angular的控制范围，只有写在ng-app所在标签内部的angular指令才会被解析 -->
<body ng-app='app' ng-controller="demoCtrl">
    
    <div>
        <h1 ng-style="titleStyle">{{title}}</h1>
        <!-- ng-bind为标签绑定内容，内容会自动被填充到标签之间 -->
       <p ng-class="'p'" ng-bind="'我是段落内容'"></p>
       <button ng-click="fn()" ng->点击</button>
    </div>
    
</body>
<script src="./libs/js/angular-1.6.9.min.js"></script>
<script>
    //声明一个模块
    var app=angular.module('app',[]);
    //声明一个控制器
    app.controller('demoCtrl',['$scope',function($scope){
        $scope.pClassName='p';
        $scope.titleStyle={color:'red'};
        $scope.title='hello';
        $scope.fn=function(){
            console.log('事件被触发了');
        }
    }]);

    // app.controller('demoCtrl',function(a){
    //     a.title='hello';
    // });
    
</script>
</html>